﻿Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports Exceptions

''' <summary>
''' This is a test class for ExceptionSeverityExtensionsTest and is intended
''' to contain all ExceptionSeverityExtensionsTest Unit Tests
''' </summary>
''' <revisions>
'''   <revision date="2/21/2009" author="CEG" version="1.00.00.000">Initial Development</revision>
''' </revisions>
<TestClass()> _
Public Class ExceptionSeverityExtensionsTest

  Private testContextInstance As TestContext

  ''' <summary>
  ''' Gets or sets the test context which provides
  ''' information about and functionality for the current test run.
  ''' </summary>
  ''' <value>The test context.</value>
  ''' <revisions>
  '''   <revision date="2/21/2009" author="CEG" version="1.00.00.000">Initial Development</revision>
  ''' </revisions>
  Public Property TestContext() As TestContext
    Get
      Return testContextInstance
    End Get
    Set(ByVal value As TestContext)
      testContextInstance = value
    End Set
  End Property

  ''' <summary>
  ''' Tests that the <see cref="ExceptionSeverityExtensions.ToInt16">ExceptionSeverityExtensions.ToInt16</see> method works as expected when supplied the <see cref="ExceptionSeverity.Critical">Critical</see> enumerated value.
  ''' </summary>
  ''' <revisions>
  '''   <revision date="2/21/2009" author="CEG" version="1.00.00.000">Initial Development</revision>
  ''' </revisions>
  <TestMethod()> _
  Public Sub UT000011()
    Assert.AreEqual(Convert.ToInt16(1), ExceptionSeverityExtensions.ToInt16(ExceptionSeverity.Critical))
  End Sub

  ''' <summary>
  ''' Tests that the <see cref="ExceptionSeverityExtensions.ToInt16">ExceptionSeverityExtensions.ToInt16</see> method works as expected when supplied the <see cref="ExceptionSeverity.Warning">Warning</see> enumerated value.
  ''' </summary>
  ''' <revisions>
  '''   <revision date="2/21/2009" author="CEG" version="1.00.00.000">Initial Development</revision>
  ''' </revisions>
  <TestMethod()> _
  Public Sub UT000012()
    Assert.AreEqual(Convert.ToInt16(2), ExceptionSeverityExtensions.ToInt16(ExceptionSeverity.Warning))
  End Sub

  ''' <summary>
  ''' Tests that the <see cref="ExceptionSeverityExtensions.ToInt16">ExceptionSeverityExtensions.ToInt16</see> method works as expected when supplied the <see cref="ExceptionSeverity.Validation">Validation</see> enumerated value.
  ''' </summary>
  ''' <revisions>
  '''   <revision date="2/21/2009" author="CEG" version="1.00.00.000">Initial Development</revision>
  ''' </revisions>
  <TestMethod()> _
  Public Sub UT000013()
    Assert.AreEqual(Convert.ToInt16(3), ExceptionSeverityExtensions.ToInt16(ExceptionSeverity.Validation))
  End Sub

  ''' <summary>
  ''' Tests that the <see cref="ExceptionSeverityExtensions.ToInt16">ExceptionSeverityExtensions.ToInt16</see> method works as expected when supplied the <see cref="ExceptionSeverity.Information">Information</see> enumerated value.
  ''' </summary>
  ''' <revisions>
  '''   <revision date="2/21/2009" author="CEG" version="1.00.00.000">Initial Development</revision>
  ''' </revisions>
  <TestMethod()> _
  Public Sub UT000014()
    Assert.AreEqual(Convert.ToInt16(4), ExceptionSeverityExtensions.ToInt16(ExceptionSeverity.Information))
  End Sub

  ''' <summary>
  ''' Tests that the <see cref="ExceptionSeverityExtensions.ToInt16">ExceptionSeverityExtensions.ToInt16</see> method throws the expected exception when supplied an invalid value.
  ''' </summary>
  ''' <revisions>
  '''   <revision date="2/21/2009" author="CEG" version="1.00.00.000">Initial Development</revision>
  ''' </revisions>
  <TestMethod(), ExpectedException(GetType(InvalidCastException), "The specified value is not value.")> _
  Public Sub UT000015()
    Dim testValue As Short
    testValue = ExceptionSeverityExtensions.ToInt16(-1)
  End Sub

End Class